package jdt.geom;

/**
 * Represents a circle in space 
 * @author Shay
 *
 */
public class Circle {

	/* --- Data members --- */
	
	/** The center of the circle */
	private Point center;
	
	/** The radius of the circle */
	private double radius;
	
	/* --- Ctors. --- */
	
	/**
	 * Construct a circle using the center and the radius
	 * @param center The center of the circle
	 * @param radius The length of the radius
	 */
	public Circle(Point center, double radius){
		this.center = center;
		this.radius = radius;
	}
	
	/* --- Public Methods --- */
	
	/**
	 * Checks if the argument point is inside the circle
	 * @param p THe point to check
	 * @return True of false as described
	 */
	public boolean contains(Point p){
		return center.distance(p) <= radius;
	}
	
	/**
	 * String representation of the radius and the center  
	 */
	@Override
	public String toString() {
		return "Circle R=" + radius + " " + center;
	}
	
	/* --- Access Methods --- */
	
	/**
	 * @return the center of the circle
	 */
	public Point getCenter() {
		return center;
	}
	
	/**
	 * @return the radius of the circle
	 */
	public double getRadius() {
		return radius;
	}
}
